<?
	session_start(); //вававаававававаавававаавава
	include 'inc/statistic.php';
 	if (!isset($_SESSION['id']))
	{
		header ("location: logout.php");
		exit('incorrect');
	}
	include 'inc/config.system.php';
	include 'inc/config.game.php';
?>


	<?include 'tpl/top.php';?>

	<h2><center>������ �����</center></h2>

<?
	$id = def($_GET['id']);
	$p  = def($_GET['p']);
	if (empty($p))
	{
		$p=1;
	}
	$off = ($p-1)*10;

	function pages ($p){
		$res = count_query("SELECT count(*) FROM k_memb WHERE m_klan='$id'");
		$row = mysql_result($res,0);
		$b   = ceil(($row/10))  ;
		$x   = 1;
		while ($b>=$x)
   		{
			if ($x==$p)
			{
				$pages .= ' ['.$x.'] ';
			}
			else
			{
				$pages .= ' <a href="?i_top.php&p='.$x.'">'.$x.'</a> ';
			}
         	$x++;
    	}
		return $pages;
	}

	$cont = count_query("SELECT *
						 FROM k_memb
						 RIGHT JOIN user ON k_memb.m_uid=user.id
						 WHERE k_memb.m_klan='$id'
						 ORDER BY user.exp DESC LIMIT $off,10");

	echo '<table cellpadding=2 cellspacing=2 border=1 bordercolor=red width=100% class="tdn"><tr><td align=center> � </td><td align=center>����</td><td align=center>���</td><td align=center>�������</td><td align=center>������</td><td align=center>������</td><td align=center>������</td><td align=center>���������</td><td align=center>������</td></tr>';

	while ($cont1 = mysql_fetch_assoc($cont)){
 		$off++;
 		if ($cont1['race']==1)
 		{
 			$name_race='������';
 		}
 		else
 		{
 			 $name_race='���������';
 		}
		print"	<tr><td>".$off."</th><td><img src=img/race".$cont1['race']."small.gif alt=".$name_race." ></th><td><a href=i_pers.php?id=".$cont1['id']." title=".$cont1['name'].">".$cont1['name']." [".$cont1['id']."] </a></th><td align=right>".lvl($cont1['exp'])."</th><td align=right>".$cont1['stat_prey']."</th><td align=right>".$cont1['stat_victim']."</th><td align=right>".$cont1['stat_win']."</th><td align=right>".$cont1['stat_loss']."</th><td align=right>".$cont1['stat_gold_p']."</th></tr>";
	}

	echo '</table>';
	echo pages($p);

?>
<?include 'tpl/footer.php';?>